home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / LINUX / BINFMTS.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  2KB  |  77 lines

  1. #ifndef _LINUX_BINFMTS_H
  2. #define _LINUX_BINFMTS_H
  3.  
  4. #include <linux/ptrace.h>
  5. #include <linux/capability.h>
  6.  
  7. /*
  8.  * MAX_ARG_PAGES defines the number of pages allocated for arguments
  9.  * and envelope for the new program. 32 should suffice, this gives
  10.  * a maximum env+arg of 128kB w/4KB pages!
  11.  */
  12. #define MAX_ARG_PAGES 32
  13.  
  14. #ifdef __KERNEL__
  15.  
  16. /*
  17.  * This structure is used to hold the arguments that are used when loading binaries.
  18.  */
  19. struct linux_binprm{
  20.     char buf[128];
  21.     unsigned long page[MAX_ARG_PAGES];
  22.     unsigned long p;
  23.     int sh_bang;
  24.     int java;        /* Java binary, prevent recursive invocation */
  25.     struct dentry * dentry;
  26.     int e_uid, e_gid;
  27.     kernel_cap_t cap_inheritable, cap_permitted, cap_effective;
  28.     int argc, envc;
  29.     char * filename;    /* Name of binary */
  30.     unsigned long loader, exec;
  31. };
  32.  
  33. /*
  34.  * This structure defines the functions that are used to load the binary formats that
  35.  * linux accepts.
  36.  */
  37. struct linux_binfmt {
  38.     struct linux_binfmt * next;
  39.     struct module *module;
  40.     int (*load_binary)(struct linux_binprm *, struct  pt_regs * regs);
  41.     int (*load_shlib)(int fd);
  42.     int (*core_dump)(long signr, struct pt_regs * regs);
  43. };
  44.  
  45. extern int register_binfmt(struct linux_binfmt *);
  46. extern int unregister_binfmt(struct linux_binfmt *);
  47.  
  48. extern int read_exec(struct dentry *, unsigned long offset,
  49.     char * addr, unsigned long count, int to_kmem);
  50.  
  51. extern int open_dentry(struct dentry *, int mode);
  52.  
  53. extern int init_elf_binfmt(void);
  54. extern int init_elf32_binfmt(void);
  55. extern int init_aout_binfmt(void);
  56. extern int init_aout32_binfmt(void);
  57. extern int init_script_binfmt(void);
  58. extern int init_java_binfmt(void);
  59. extern int init_em86_binfmt(void);
  60. extern int init_misc_binfmt(void);
  61.  
  62. extern int prepare_binprm(struct linux_binprm *);
  63. extern void remove_arg_zero(struct linux_binprm *);
  64. extern int search_binary_handler(struct linux_binprm *,struct pt_regs *);
  65. extern int flush_old_exec(struct linux_binprm * bprm);
  66. extern unsigned long setup_arg_pages(unsigned long p, struct linux_binprm * bprm);
  67. extern unsigned long copy_strings(int argc,char ** argv,unsigned long *page,
  68.         unsigned long p, int from_kmem);
  69.  
  70. extern void compute_creds(struct linux_binprm *binprm);
  71.  
  72. /* this eventually goes away */
  73. #define change_ldt(a,b) setup_arg_pages(a,b)
  74.  
  75. #endif /* __KERNEL__ */
  76. #endif /* _LINUX_BINFMTS_H */
  77.